Uec3.CompanyWindow = Ext.extend(Ext.app.Module, {
	id : 'company',
	type : 'common/company',

	init : function(initParams) {},

	getComponents : function(module) {

		var company_dist_cmb;
		var company_city_cmb;
		var company_prov_cmb;
		var company_ajax;
		var companyForm;
        var businessLicenseFile1;
        var taxCertificationFile;
        var companyType_combox;
        var isLoad=true;
		var componentCompanyInits = function() {			
			function choosePicture(name, v, check,hiddenName) {
				if (check) {
					Ext.Msg.confirm('提示', '已上传图片,是否重新上传', function(btn) {
								if (btn == 'yes') {
									if (Ext.util.Format.lowercase(v).lastIndexOf(".jpg") != -1||
										Ext.util.Format.lowercase(v).lastIndexOf(".gif") != -1|| Ext.util.Format.lowercase(v).lastIndexOf(".png") != -1) {													
										companyForm.getForm().findField(hiddenName).setValue(v);			
									} else {Ext.Msg.alert("错误", "请选择正确的图片文件"); companyForm.getForm().findField(name).reset();}
								} else {companyForm.getForm().findField(name).reset();}
							})

				} else {
					if (Ext.util.Format.lowercase(v).lastIndexOf(".jpg") != -1|| Ext.util.Format.lowercase(v).lastIndexOf(".gif") != -1||
						Ext.util.Format.lowercase(v).lastIndexOf(".png") != -1) {					
						companyForm.getForm().findField(hiddenName).setValue(v);									
					} else {Ext.Msg.alert("错误", "请选择正确的图片文件");companyForm.getForm().findField(name).reset();}
				}
			}			
			// 区县下拉框
			company_dist_cmb = getDistrictCombox(Uec3.App.Constants.homeUrl);
			company_dist_cmb.setWidth(100);
			//company_dist_cmb.allowBlank=false;
			company_dist_cmb.blankText="公司信息地区必须填写";
			company_dist_cmb.anchor="99%";
			// 城市下拉框
			company_city_cmb = getCityCombox(Uec3.App.Constants.homeUrl,
					company_dist_cmb);
			company_city_cmb.setWidth(100);
			company_city_cmb.allowBlank=false;
			company_city_cmb.blankText="公司信息城市必须填写";
			company_city_cmb.anchor="99%";
			// 省份下拉框
			company_prov_cmb = getProvinceCombox(Uec3.App.Constants.homeUrl,
					company_city_cmb, company_dist_cmb);
			company_prov_cmb.setWidth(100);
			company_prov_cmb.allowBlank=false;
			company_prov_cmb.blankText="公司信息省份必须填写";
			company_prov_cmb.anchor='99%';

			businessLicenseFile1 = new Ext.form.FileUploadField({

				emptyText : '请选择营业执照副本复印件...',
				style : "margin-left:6px",
				height : 30,
				width : 320,
				columnWidth:0.45,
				name : 'businessLicenseFile',
				buttonText : '',
				blankText : "营业执照副本复印件不允许为空",
				buttonCfg : {iconCls : 'icon-photo'},
				listeners : {
					'fileselected' : function(fb, v) {
					   var rootElement = companyForm.getForm().reader.jsonData.root;
					   choosePicture('businessLicenseFile', v,rootElement.businessLicensePath,"businessLicenseFileName");
					}
				}
			});

			taxCertificationFile = new Ext.form.FileUploadField({

				emptyText : '请选择税务登记证副本复印件...',
				style : "margin-left:6px",
				columnWidth:0.45,
				height : 30,
				width : 320,
				blankText : "税务登记证副本复印件不允许为空",
				name : 'taxCertificationFile',
				buttonText : '',
				buttonCfg : {iconCls : 'icon-photo'},
				listeners : {
					'fileselected' : function(fb, v) {
						var rootElement = companyForm.getForm().reader.jsonData.root;
						choosePicture('taxCertificationFile', v,rootElement.taxCertificationPath,"taxCertificationFileName");
					}
				}
			});
			
			var formReader = new Ext.data.JsonReader(
			       {
						root : 'root'
					}, [
					    {name : 'id',type : 'int'},
					    {name : 'creatorId',type : 'int'},
					    {name : 'email',type : 'string'}, 
					    {name : 'name',type : 'string'},
					    {name : 'contactorIdentityCode',type : 'string'},
					    {name : 'contactorIdPath',type : 'string'},
					    {name : 'businessLicensePath',type : 'string'}, 
					    {name : 'taxCertificationPath',type : 'string'},
					    {name : 'fax',type : 'string'},
					    {name : 'invoicAddress',type : 'string'}, 
						{name : 'bankName',type : 'string'}, 
						{name : 'bankCode',type : 'string'},
						{name : 'address',type : 'string'}, 
						{name : 'qq',type : 'string'}, 
						{name : 'realType',type : 'int'}, 
						{name : 'companyType',type : 'int'},
						{name : 'requestRealType',type : 'int'},
						{name : 'requestCompanyType',type : 'int'},
						{name : 'msn',type : 'string'},
						{name : 'web',type : 'string'},
						{name : 'marketName',type : 'string'},
						{name : 'contactor',type : 'string'}, 
						{name : 'taxCode',type : 'string'},
						{name : 'areaId',type : 'int'}, 
						{name : 'code',type : 'string'},
						{name : 'simpleName',type : 'string'},
						{name : 'creatorName',type : 'string'},
						{name : 'nameEn',type : 'string'}, 
						{name : 'business',type : 'string'}, 
						{name : 'certifyingStatusName',type : 'string'},
						{name : 'certifyingStatus',type : 'int'},
						{name : 'postcode',type : 'string'},
						{name : 'tel',type : 'string'},
						{name : 'gmtModify',type : 'string'}
					]
			);					
			    companyType_combox = Uec3.App.dictionary.getCombo('requestCompany_rtype',{
					hiddenName : 'requestCompanyType',fieldLabel : '公司类型',blankText : '公司类型不能为空',
					emptyText : '请选择公司类型',anchor :'99%',width:150,forceSelection : true
				});
//{ xtype:'textfield',fieldLabel:'法人身份证',name:'contactorIdentityCode',anchor:'99%',	regex : /(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/,
		//	regexText : '输入的身份证号长度不对，或者号码不符合规定！15位号码应全为数字，18位号码末位可以为数字或x,X'}
			company_ajax = new Ext.data.Connection();
			
			companyForm = new Ext.form.FormPanel({
				labelAlign : 'right',
				frame : true,
				height : 520,
				fileUpload : true,
				labelWidth : 80,
				loadingText : '加载数据中...',
				buttonAlign : 'center',
				url : '',
				reader : formReader,
				items : [ {
      xtype:'fieldset',
      title: '基本信息',
      height:120,
      collapsed: false,
      items :[
        {
          layout:'column',
          items:[
           {
             columnWidth:0.5,
             items:[
               {
                layout:'form',
                labelWidth:70,
                items:[{name : 'id',fieldLabel : 'ID', xtype : 'hidden'},
                       {name : 'gmtModify',fieldLabel : '修改时间', xtype : 'hidden'},
                {name : 'contactorIdFileName',fieldLabel : '身份证名称', xtype : 'hidden'},
                {name : 'businessLicenseFileName',fieldLabel : '营业执照名称', xtype : 'hidden'},
                {name : 'taxCertificationFileName',fieldLabel : '税号名称', xtype : 'hidden'},
                {name : 'creatorId',fieldLabel : 'ID', xtype : 'hidden'},
                       {name : 'areaId',fieldLabel : 'areaId', xtype : 'hidden'},
                  	{xtype:'textfield',fieldLabel:'公司名称', name:'name',width:150,anchor:'99%',blankText:"公司名称不允许为空",maxLengthText : "公司名称长度不大于30位"}]
               },
               	{
                layout:'form',
                labelWidth:70,
                items:[
                  	{xtype:'textfield',fieldLabel : '公司简称',name : 'simpleName',anchor:'99%',maxLength:30,maxLengthText : "公司简称长度不大于20位"}]
               },
               		{
                layout:'column',
                items:[{
                    columnWidth:0.46,
                    items:[{
                         layout:'form',
                         labelWidth:70,
                         items:[{xtype:'textfield',fieldLabel:'负责人/法人',name:'contactor',anchor:'99%',blankText:"公司法人名称必须填写",maxLength:30,maxLengthText : "负责人/法人长度不大于20位"} ]}]
                   },{
                    columnWidth:0.54,
                    items:[{
                         layout:'form',
                         labelAlign:'right',
                         labelWidth:70,
                         items:[companyType_combox]}]
                  }
                ]
               }]
           },{
             columnWidth:0.5,
             items:[{
                layout:'form',
                labelWidth:70,
                labelAlign:'right',
                items:[{xtype:'textfield',fieldLabel:'经营项目',name:'business',blankText:"公司经营项目必须填写",anchor:'99%',maxLength:30,maxLengthText : "经营项目长度不大于30位"}]
               },{
                layout:'form',
                labelWidth:70,
                items:[
                  	{xtype:'textfield',fieldLabel : '英文名称',anchor:'99%',name : 'nameEn',maxLength:30,maxLengthText : "英文名称长度不大于30位"}]
               },{
                layout:'column',  
                labelWidth:70,              
                items:[
    		               {columnWidth:0.4,items:[{layout:'form',labelWidth:70,items:[company_prov_cmb]}]},
    				       {columnWidth:0.3,items:[{layout:'form',labelWidth:30,items:[company_city_cmb]}]},
    				       {columnWidth:0.3,items:[{layout:'form',labelWidth:30,items:[company_dist_cmb]}]}
                    ]
                }]
               }]
             }]
      },{
		xtype : 'fieldset',
		title : '实名信息',
		height: 125,		
		items:[{
			xtype : 'panel',
			defaultType : 'textfield',
			anchor : '99%',
			layout : 'column',
			labelAlign:'right',
			style : "margin-left:10px",
			border : false,
			items : [
			         {columnWidth:0.1,xtype : 'label',cls : "x-form-field",style : "margin-top:4px",text : '法人身份证:'},
			         {columnWidth:0.3,name : 'contactorIdentityCode',blankText : '请填写身份证号',regex:/^[0-9]+$/,
			          regexText:'请输入正确的数字格式',maxLength:18,minLengthText:"身份证长度不能大于18位",width : 200},
                     {xtype : 'label',columnWidth:0.15,cls : "x-form-field",style : "margin-top:4px;margin-left:20px",text : '法人身份证复印件:'},
                     {columnWidth:0.45,xtype : 'fileuploadfield',emptyText : '请选择法人身份证复印件...',name : 'contactorIdentityFile',
					  width : 320,style : "margin-left:6px",height : 30,buttonText : '',blankText : "法人身份证复印件不允许为空",
						buttonCfg : {iconCls : 'icon-photo'},
						listeners : {
							'fileselected' : function(fb, v) {
								var rootElement = companyForm.getForm().reader.jsonData.root;
								choosePicture('contactorIdentityFile',v,rootElement.contactorIdPath,"contactorIdFileName");
							}
						}
					}]
		},
		{
			xtype : 'panel',defaultType : 'textfield',style : "margin-left:10px",layout : 'column',labelAlign:'right',border : false,
			items : [
			         {xtype : 'label',columnWidth:0.1,text : '税号:',cls : "x-form-field",style : "margin-top:4px;"}, 
					{
						name : 'taxCode',
						width : 200,
						regex:/^[0-9]+$/,
						regexText:'请输入正确的数字格式',
						maxLength:15,
						minLengthText:"税号长度不能大于15位",
						columnWidth:0.3,
						blankText : '税号必须填写'
					}, {
						xtype : 'label',
						text : '税务登记证复印件:',
						columnWidth:0.15,
						cls : "x-form-field",
						style : "margin-top:4px;margin-left:20px"
					},  taxCertificationFile]
		},{
			xtype : 'panel',
			defaultType : 'textfield',
			style : "margin-left:10px",
			anchor : '99%',
			labelAlign:'right',
			layout : 'column',
			border : false,
			items : [{
						xtype : 'label',cls : "x-form-field",columnWidth:0.1,
						style : "margin-top:4px;",text : '工商注册号:'
					}, {
						name : 'code',width : 200,regex:/^[0-9]+$/,regexText:'请输入正确的数字格式',
						maxLength:15,minLengthText:"工商注册号长度不能大于15位",columnWidth:0.3,blankText : '工商注册号必须填写'
					},

					{xtype : 'label',cls : "x-form-field",columnWidth:0.15,style : "margin-top:4px;margin-left:20px;",text : '营业执照复印件:'
					}, businessLicenseFile1]
		}]
	},{
		xtype : 'fieldset',
		title : '联系方式',
		height: 139,		
		items:[{
		        layout:'column',
		        items:[{
		           	 columnWidth:0.5,
		             items:[{
		                 layout:'form',
		                 labelWidth:70,
		                 labelAlign:'right',
		                 items:[{xtype:'textfield',fieldLabel : '通讯地址',name : 'address',anchor:'99%',maxLength:30,maxLengthText : "通讯地址长度不大于30位"}]}]
		           },{
		           	 columnWidth:0.25,
		             items:[{
		                 layout:'form',
		                 labelWidth:56,
		                 labelAlign:'right',
		                 items:[{xtype:'textfield',fieldLabel : '邮编',name : 'postcode',anchor:'99%',maxLength:6,maxLengthText : "邮编最大长度不超过6个字符"}]}]
		           }
		        ]
		       },{
			       	 layout:'column',
			       	 items:[{
			             columnWidth:0.5,
			       	     items:[{layout:'form',
			       	            labelWidth:56, labelAlign:'right',items:[{xtype : 'textfield',fieldLabel : 'MSN号',
															name : 'msn',
															anchor:'99%',
															vtype:'email',
															vtypeText:'请填写正确的MSN格式(如:huarun@hotmail.com)'}]}]
			       	   },{
			             columnWidth:0.5,
			       	     items:[{
			       	     		layout:'form',
			       	            labelWidth:56,
			       	            labelAlign:'right',
			       	            items:[{xtype : 'textfield',fieldLabel:'网址',name : 'web',anchor:'99%',maxLength:30,maxLengthText : "网址长度不大于30位"}]
			       	       }]
			       	   }]
			       },{
		       	 layout:'column',
		       	 items:[
		       	   {
		       	     columnWidth:0.25,
		       	     items:[{
		       	         layout:'form',
		       	         labelWidth:70,
		       	         items:[{xtype:'textfield',fieldLabel:'开户行',name:'bankName',anchor:'99%',maxLength:30,maxLengthText : "开户行长度不大于30位"}]
		       	       },{
		       	       	 layout:'form',
		       	       	 labelWidth:70,
		       	         items:[{xtype:'textfield',fieldLabel:'联系电话',name:'tel',maxLength:30,maxLengthText : "联系电话长度不大于30位",anchor:'99%'}]
		       	       }
		       	     ]
		       	   },{
		             columnWidth:0.25,
		       	     items:[{
		       	         layout:'form',
		       	         labelWidth:70,
		       	         labelAlign:'right',
		       	         items:[{xtype:'textfield',fieldLabel:'银行账号',name:'bankCode',anchor:'99%',maxLength:30,maxLengthText : "银行账号长度不大于30位"}]
		       	       },{
		       	       	 layout:'form',
		       	       	 labelWidth:70,
		       	       	 labelAlign:'right',
		       	         items:[{xtype:'textfield',fieldLabel:'传真电话',name:'fax',maxLength:30,maxLengthText : "传真电话长度不大于30位",anchor:'99%'}]
		       	       }
		       	     ]
		       	   },{
		             columnWidth:0.5,
		       	     items:[{
		       	     		layout:'form',
		       	            labelWidth:56,
		       	            labelAlign:'right',
		       	            items:[{xtype:'textfield',fieldLabel:'发票地址',name:'invoicAddress',anchor:'99%',maxLength:30,maxLengthText : "发票地址长度不大于30位"}]
		       	       },{
		       	       	 layout:'column',
		       	         items:[{
		       	            columnWidth:.5,
		       	            items:[{
		       	                layout:'form',
		       	                labelWidth:56,
		       	                labelAlign:'right',
		       	                items:[{xtype : 'numberfield',
														fieldLabel : 'QQ号',
														name : 'qq',
														regex:/^[1-9]{1}\d{4,12}$/,
														regexText:'请填写正确的qq格式和长度',anchor:'99%'}]}]
		       	           },{
		       	           	columnWidth:.5,
		       	            items:[{
		       	                layout:'form',
		       	                labelWidth:70,
		       	                labelAlign:'right',
		       	                items:[{xtype:'textfield',fieldLabel:'E-Mail',name:'email',anchor:'99%',
														vtype : 'email',
														vtypeText:'请填写正确的邮箱格式(如:huarun@gmail.com)'}]}]
		       	           }]}]
		       	   }]
		       }]
	},{
		height: 100,		
		items:[{
			xtype : 'panel',
			defaultType : 'textfield',
			layout : 'column',
			labelAlign:'right',
			style : "margin-left:15px",
			border : false,
			items : [
			        {xtype : 'label',columnWidth:0.08,text : "公司创建人:",cls : "x-form-field",style : "margin-top:4px;"}, 
			        {name : 'creatorName',width : 200,style : "color:#cc0000;",readOnly:true,columnWidth:0.2}, 
					{xtype : 'label',text : "认证状态:",columnWidth:0.08,cls : "x-form-field",style : "margin-top:4px;margin-left:6px"},
					{name : 'certifyingStatusName',width : 200,readOnly:true,style : "color:#cc0000;",columnWidth:0.2},
					{xtype : 'label',text : "所在市场:",columnWidth:0.08,cls : "x-form-field",style : "margin-top:4px;margin-left:6px"},
					{name : 'marketName',width : 200,readOnly:true,style : "color:#cc0000;",columnWidth:0.2}
				]
		}]
	}],
				buttons : [{
					text : '修改',
					iconCls:"icon-edit",
					handler : function() {
					companyType_combox.allowBlank = true;
					companyForm.getForm().findField("taxCertificationFile").allowBlank = true;
					companyForm.getForm().findField("contactorIdentityFile").allowBlank = true;
					companyForm.getForm().findField("contactorIdentityCode").allowBlank = true;
					companyForm.getForm().findField("contactorIdentityCode").regex=/^[0-9]+$/;
					companyForm.getForm().findField("contactorIdentityCode").regexText='请输入正确的数字格式';
					companyForm.getForm().findField("contactorIdentityCode").maxLength=18;
					companyForm.getForm().findField("contactorIdentityCode").minLength=0;
					companyForm.getForm().findField("contactorIdentityCode").maxLengthText="身份证长度不能大于18位";
					companyForm.getForm().findField("taxCode").maxLength=15;
					companyForm.getForm().findField("taxCode").minLength=0;
					companyForm.getForm().findField("taxCode").maxLengthText="税号长度不能大于15位";
					companyForm.getForm().findField("taxCode").maxLength=15;
					companyForm.getForm().findField("taxCode").minLength=0;
					companyForm.getForm().findField("code").maxLengthText="营业执照长度不能大于15位";
					companyForm.getForm().findField("name").allowBlank = true;
					companyForm.getForm().findField("business").allowBlank = true;
					companyForm.getForm().findField("taxCode").allowBlank = true;
					companyForm.getForm().findField("code").allowBlank = true;
					companyForm.getForm().findField("contactor").allowBlank = true;				
					companyForm.getForm().findField("businessLicenseFile").allowBlank = true;
						
						isLoad=false;						
						if (!companyForm.getForm().isValid()) {Ext.Msg.alert("提示", "请按要求正确填写");return;}
						var formValues = companyForm.getForm().getValues();
						var jsonAll = Ext.encode(formValues);

				    companyForm.getForm().submit({
					url : Uec3.App.Constants.homeUrl+ '/company/modify_company.do',
					method : "post",
					params:{jsonAll:jsonAll},
					waitMsg : '修改数据中...',
					success : function(form, action) {			
					if (action.result.success == "OK"){			
						    Ext.Msg.alert("提示", "修改成功!",function(){			    	
								companyForm.getForm().load({url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do'									});				    	
						    });					
						} else {Ext.Msg.alert("提示",action.result.failure);}
				},
					failure : function(form, action) {
						Ext.Msg.alert("错误提示",action.result.failure,function(){companyForm.getForm().load({url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do'});});
					}
				});
						}

				 },{
					text : '请求个人认证 ',
					iconCls:"icon-certify",																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																					
					handler : function() {
				    companyType_combox.allowBlank = false;
					companyForm.getForm().findField("taxCertificationFile").allowBlank = true;	
					companyForm.getForm().findField("contactorIdentityFile").allowBlank = false;	
					companyForm.getForm().findField("contactorIdentityCode").allowBlank = false;
					companyForm.getForm().findField("contactorIdentityCode").regex =/(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/;
					companyForm.getForm().findField("contactorIdentityCode").regexText ='输入的身份证号长度不对，或者号码不符合规定！15位号码应全为数字，18位号码末位可以为数字或x,X'
					companyForm.getForm().findField("name").allowBlank = false;
					companyForm.getForm().findField("business").allowBlank = false;
					companyForm.getForm().findField("taxCode").allowBlank = true;
					companyForm.getForm().findField("code").allowBlank = true;
					companyForm.getForm().findField("contactor").allowBlank = false;				
					companyForm.getForm().findField("businessLicenseFile").allowBlank = true;		
				
	    isLoad=true;
		if (!companyForm.getForm().isValid()) {Ext.Msg.alert("提示", "请按照要求进行正确操作");return;}
           var value = companyForm.getForm().getValues();         
           var  jsonAll = Ext.encode(value);               
		    Ext.Msg.confirm('提示', "如果个人认证一旦成功，除了税号和工商注册号,其他公司基本信息包括公司类型将不能再修改,还继续执行吗?",
			function(button) {
			if (button == 'yes') {
				companyForm.getForm().submit({
				url : Uec3.App.Constants.homeUrl+ '/certify/submit_Certify.do',
				method : "post",params:{jsonAll:jsonAll,requestRealType:1},waitMsg : '正在保存数据...',
				success : function(form, action) {			
				companyForm.getForm().load({
						url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do',
						success : function(form, action) {
                        var rootFirstValue=form.reader.jsonData.root;
					    companyForm.buttons[1].hide();
					    form.findField("contactorIdentityFile").setValue(rootFirstValue.contactorIdFileName);
					    form.findField("name").style="color:#aaaaaa";					     
						}
					});
				},
				failure : function(form, action) {Ext.Msg.alert("错误", action.result.failure);}
			});
					}
				});
			},
					style : "margin-left:20px"
				},{	
					text : '请求公司认证',
					iconCls:"icon-certify",
					handler : function() {
					companyType_combox.allowBlank = false;
					companyForm.getForm().findField("taxCertificationFile").allowBlank = false;	
					companyForm.getForm().findField("taxCode").maxLength=15
					companyForm.getForm().findField("taxCode").minLength=15
					companyForm.getForm().findField("taxCode").maxLengthText ='税号的长度等于15位'
					companyForm.getForm().findField("taxCode").minLengthText ='税号的长度等于15位'
					companyForm.getForm().findField("contactorIdentityCode").allowBlank = false;
					companyForm.getForm().findField("contactorIdentityCode").regex =/(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/;
					companyForm.getForm().findField("contactorIdentityCode").regexText ='输入的身份证号长度不对，或者号码不符合规定！15位号码应全为数字，18位号码末位可以为数字或x,X'
					companyForm.getForm().findField("name").allowBlank = false;
					companyForm.getForm().findField("business").allowBlank = false;
					companyForm.getForm().findField("taxCode").allowBlank = false;
					companyForm.getForm().findField("code").allowBlank = false;
					companyForm.getForm().findField("contactor").allowBlank = false;				
					companyForm.getForm().findField("businessLicenseFile").allowBlank = false;
					companyForm.getForm().findField("code").maxLength=15
					companyForm.getForm().findField("code").minLength=15
					companyForm.getForm().findField("code").maxLengthText ='营业执照的长度等于15位'
					companyForm.getForm().findField("code").minLengthText ='营业执照的长度等于15位'
		isLoad=true;				
		if (!companyForm.getForm().isValid()) {Ext.Msg.alert("提示", "请按照要求进行正确操作");return;}
           var value = companyForm.getForm().getValues();        
           var  jsonAll = Ext.encode(value);
		    Ext.Msg.confirm('提示', "如果公司认证成功,所有公司基本信息将不能再修改,还继续执行吗?",function(button) {
			if (button == 'yes') {
				companyForm.getForm().submit({
				url : Uec3.App.Constants.homeUrl+ '/certify/submit_Certify.do',
				method : "post",params:{jsonAll:jsonAll,requestRealType:2},waitMsg : '正在保存数据...',
				success : function(form, action) {				
				companyForm.getForm().load({url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do',
					success : function(form, action) {
                    var rootFirstValue=form.reader.jsonData.root;
					companyForm.buttons[1].hide();
					companyForm.buttons[2].hide();
					form.findField("contactorIdentityFile").setValue(rootFirstValue.contactorIdFileName);
			    	form.findField("businessLicenseFile").setValue(rootFirstValue.businessLicenseFileName);
			        form.findField("taxCertificationFile").setValue(rootFirstValue.taxCertificationFileName);
				}
					});
				},
				failure : function(form, action) {Ext.Msg.alert("错误", action.result.failure);}
			});}
						});
					},
					style : "margin-left:20px"
				},{text : '关闭',iconCls:"icon-close",handler : function() {companyForm.ownerCt.close();},style : "margin-left:20px"}]
			});
			// 加载form表单数据
			companyForm.getForm().load({url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do'});
		};

		var controlCompanyEvent = function() {
			
			company_prov_cmb.on('select', function(combox) {companyForm.getForm().findField('areaId').setValue(combox.getValue());});

			company_city_cmb.on('select', function(combox) {companyForm.getForm().findField('areaId').setValue(combox.getValue());});

			company_dist_cmb.on('select', function(combox) {companyForm.getForm().findField('areaId').setValue(combox.getValue());});

			company_ajax.on('beforerequest', function() {Ext.MessageBox.wait("更新数据中...", "提示");});

			company_ajax.on('requestcomplete', function() {Ext.MessageBox.hide();});

			companyForm.getForm().on('actioncomplete', function(form){
			    var rootFirstValue=form.reader.jsonData.root;
			    if(!isLoad){return;}			    
			     if(rootFirstValue.certifyingStatus==1||rootFirstValue.certifyingStatus==3){		    	
			     if(rootFirstValue.certifyingStatus==1){companyForm.buttons[2].hide();}		    	
			    	form.findField("name").el.dom.style.color="#aaaaaa";
			    	form.findField("simpleName").el.dom.style.color="#aaaaaa";
			    	form.findField("contactorIdentityCode").el.dom.style.color="#aaaaaa";
			    	form.findField("nameEn").el.dom.style.color="#aaaaaa";
			    	form.findField("contactor").el.dom.style.color="#aaaaaa";
			    	form.findField("business").el.dom.style.color="#aaaaaa";
			    	form.findField("requestCompanyType").el.dom.style.color="#aaaaaa";
			    	form.findField("simpleName").setReadOnly(true);
					form.findField("contactorIdentityCode").setReadOnly(true);
					form.findField("contactorIdentityFile").setDisabled(true);
					company_dist_cmb.setDisabled(true);
					company_city_cmb.setDisabled(true);
					company_prov_cmb.setDisabled(true);
					form.findField("name").setReadOnly(true);
					form.findField("nameEn").setReadOnly(true);
					form.findField("contactor").setReadOnly(true);
				    form.findField("requestCompanyType").setReadOnly(true);
					form.findField("business").setReadOnly(true);
					form.findField("taxCertificationFile").allowBlank = true;
					form.findField("businessLicenseFile").allowBlank = true;
					form.findField("taxCode").allowBlank = true;
					form.findField("code").allowBlank = true;
			    	companyForm.buttons[1].hide();
			    	
			    }
			   if(rootFirstValue.certifyingStatus==2||rootFirstValue.certifyingStatus==4){
			    	form.findField("name").el.dom.style.color="#aaaaaa";
			    	form.findField("simpleName").el.dom.style.color="#aaaaaa";
			    	form.findField("contactorIdentityCode").el.dom.style.color="#aaaaaa";
			    	form.findField("nameEn").el.dom.style.color="#aaaaaa";
			    	form.findField("contactor").el.dom.style.color="#aaaaaa";
			    	form.findField("business").el.dom.style.color="#aaaaaa";	
			    	form.findField("taxCode").el.dom.style.color="#aaaaaa";	
			    	form.findField("code").el.dom.style.color="#aaaaaa";
			    	form.findField("requestCompanyType").el.dom.style.color="#aaaaaa";			    		
			    	form.findField("simpleName").setReadOnly(true);
					form.findField("contactorIdentityCode").setReadOnly(true);
					form.findField("contactorIdentityFile").setDisabled(true);
					form.findField("businessLicenseFile").setDisabled(true);
					form.findField("taxCertificationFile").setDisabled(true);
					company_dist_cmb.setDisabled(true);
					company_city_cmb.setDisabled(true);
					company_prov_cmb.setDisabled(true);
					form.findField("taxCode").setReadOnly(true);
					form.findField("code").setReadOnly(true);
					form.findField("name").setReadOnly(true);
					form.findField("nameEn").setReadOnly(true);
					form.findField("contactor").setReadOnly(true);
				    form.findField("requestCompanyType").setReadOnly(true);
					form.findField("business").setReadOnly(true);
			    	companyForm.buttons[1].hide();
			    	companyForm.buttons[2].hide();
			    }
			    if(rootFirstValue.certifyingStatus==5){
			    	form.findField("name").el.dom.style.color="";
			    	form.findField("simpleName").el.dom.style.color="";
			    	form.findField("contactorIdentityCode").el.dom.style.color="";
			    	form.findField("nameEn").el.dom.style.color="";
			    	form.findField("contactor").el.dom.style.color="";
			    	form.findField("business").el.dom.style.color="";
			    	form.findField("requestCompanyType").el.dom.style.color="";	    
			    	form.findField("simpleName").setReadOnly(false);
					form.findField("contactorIdentityCode").setReadOnly(false);
					form.findField("contactorIdentityFile").setDisabled(false);
					company_dist_cmb.setDisabled(false);
					company_city_cmb.setDisabled(false);
					company_prov_cmb.setDisabled(false);
					form.findField("name").setReadOnly(false);
					form.findField("nameEn").setReadOnly(false);
					form.findField("contactor").setReadOnly(false);
				    form.findField("requestCompanyType").setReadOnly(true);
					form.findField("business").setReadOnly(false);
					form.findField("taxCertificationFile").allowBlank = true;
					form.findField("businessLicenseFile").allowBlank = true;
					form.findField("taxCode").allowBlank = true;
					form.findField("code").allowBlank = true;
			    	companyForm.buttons[1].show(); 
			    
			    }
			    	if(rootFirstValue.certifyingStatus==6){
			    	
			           if(rootFirstValue.realType==1){					        	
					        form.findField("name").el.dom.style.color="#aaaaaa";
					    	form.findField("simpleName").el.dom.style.color="#aaaaaa";
					    	form.findField("contactorIdentityCode").el.dom.style.color="#aaaaaa";
					    	form.findField("nameEn").el.dom.style.color="#aaaaaa";
					    	form.findField("contactor").el.dom.style.color="#aaaaaa";
					    	form.findField("business").el.dom.style.color="#aaaaaa";	
					        form.findField("taxCode").el.dom.style.color="";	
					    	form.findField("code").el.dom.style.color="";
					    	form.findField("requestCompanyType").el.dom.style.color="#aaaaaa";				    	
					    	form.findField("simpleName").setReadOnly(true);
							form.findField("contactorIdentityCode").setReadOnly(true);
							form.findField("contactorIdentityFile").setDisabled(true);
							form.findField("contactorIdentityFile").allowBlank = false;
							company_dist_cmb.setDisabled(true);
							company_city_cmb.setDisabled(true);
							company_prov_cmb.setDisabled(true);
							form.findField("name").setReadOnly(true);
							form.findField("nameEn").setReadOnly(true);
							form.findField("contactor").setReadOnly(true);
						    form.findField("requestCompanyType").setReadOnly(true);
							form.findField("business").setReadOnly(true);
							form.findField("taxCertificationFile").allowBlank = true;
							form.findField("businessLicenseFile").allowBlank = true;
							form.findField("taxCode").allowBlank = true;
							form.findField("code").allowBlank = true;
							companyForm.buttons[1].hide();
					    	companyForm.buttons[2].show(); 
			    		       
			       }else{
					       	form.findField("name").el.dom.style.color="";
					    	form.findField("simpleName").el.dom.style.color="";
					    	form.findField("contactorIdentityCode").el.dom.style.color="";
					    	form.findField("nameEn").el.dom.style.color="";
					    	form.findField("contactor").el.dom.style.color="";
					    	form.findField("business").el.dom.style.color="";	
					    	form.findField("taxCode").el.dom.style.color="";	
					    	form.findField("code").el.dom.style.color="";
					       	form.findField("requestCompanyType").el.dom.style.color="";				       	
					    	form.findField("simpleName").setReadOnly(false);
							form.findField("contactorIdentityCode").setReadOnly(false);
							form.findField("contactorIdentityFile").setDisabled(false);
							form.findField("contactorIdentityFile").allowBlank = true;
							company_dist_cmb.setDisabled(false);
							company_city_cmb.setDisabled(false);
							company_prov_cmb.setDisabled(false);
							form.findField("name").setReadOnly(false);
							form.findField("nameEn").setReadOnly(false);
							form.findField("contactor").setReadOnly(false);
						    form.findField("requestCompanyType").setReadOnly(false);
							form.findField("business").setReadOnly(false);
							form.findField("taxCertificationFile").setDisabled(false);
							form.findField("taxCertificationFile").allowBlank = true;
							form.findField("businessLicenseFile").setDisabled(false);
							form.findField("businessLicenseFile").allowBlank = true;
							form.findField("taxCode").allowBlank = true;
							form.findField("code").allowBlank = true;
					    	companyForm.buttons[1].show();
					    	companyForm.buttons[2].show();		       
			       }
			    }
			    	companyForm.getForm().findField("contactorIdentityFile").setValue(rootFirstValue.contactorIdFileName);
			    	companyForm.getForm().findField("businessLicenseFile").setValue(rootFirstValue.businessLicenseFileName);
			        companyForm.getForm().findField("taxCertificationFile").setValue(rootFirstValue.taxCertificationFileName);				
				var maskTopField = new Ext.LoadMaskJUPIT(companyForm.id);
				if(!module.app.hasPermission(10)){
					companyForm.buttons[0].hide();
					companyForm.buttons[1].hide();
					companyForm.buttons[2].hide();
					maskTopField.show();		
				}					
				company_prov_cmb.setRawValue(rootFirstValue.province);
				company_city_cmb.setRawValue(rootFirstValue.city);
				company_dist_cmb.setRawValue(rootFirstValue.district);
				if (rootFirstValue.province) {
					company_city_cmb.getStore().setBaseParam("prov",rootFirstValue.provinceId);
					company_city_cmb.getStore().load();
				}
				if (rootFirstValue.city) {
					company_dist_cmb.getStore().setBaseParam("city",rootFirstValue.cityId);
					company_dist_cmb.getStore().load();
				}
			});
		};
		
		componentCompanyInits();

		controlCompanyEvent();

		return companyForm;
	},
	createWindow : function() {
		var desktop = this.app.getDesktop();
		var win = desktop.getWindow('company');
		var module = this;
		if (!win) {
			win = desktop.createWindow({
						id : 'company',
						title : '公司信息',
						width :900,
						height : 520,
						iconCls : 'acc-icon',
						autoScroll : true,
						shim : false,
						animCollapse : false,
						constrainHeader : true,
						maximizable : false,
						resizable : false,
						taskbuttonTooltip : "公司信息列表",
						layout : "fit",
						tools : [{id : 'refresh',handler : Ext.emptyFn,scope : this}],
						items : [this.getComponents(this)]
					});
		}
		formBingingKeys(win.items.get(0),win);
		win.show();
	}
});